<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 800px;
            height: 300px;
            padding: 100px 250px;
            box-sizing: border-box;
            background: no-repeat center cover;
        }
    </style>
</head>
<body>
    <div class="demo" style="width: 600px;height: 400px;"></div>
    <div class="box">
        传智慧教育年会抽奖
        <h2>一等奖:<span class="one">Jay</span></h2>
        <h3>二等奖:<span class="two">周杰伦</span></h3>
        <h4>三等奖:<span class="three">周杰伦</span></h4>
    </div>
    <script>
        const personArr=['周杰伦','刘德华','周星驰','范老师','张学友']
        const arr=['one','two','three']
        for(let i=0;i<arr.length;i++){
            const ran=Math.floor(Math.random()*arr.length)
            const span=document.querySelector('.'+arr[i])
            span.innerHTML=personArr[ran]
            personArr.splice(ran,1)
        }
        console.log(personArr)



        // const personArr=['周杰伦','刘德华','周星驰','范老师','张学友']
        // //一等奖
        // let a=Math.floor(Math.random()*personArr.length)
        // const one=document.querySelector('.one')
        // one.innerHTML=personArr[a]
        // personArr.splice(a,1)
        // console.log(personArr)
        // //二等奖
        // let b=Math.floor(Math.random()*personArr.length)
        // const two=document.querySelector('.two')
        // two.innerHTML=personArr[b]
        // personArr.splice(b,1)
        // console.log(personArr)
        // //三等奖
        // let c=Math.floor(Math.random()*personArr.length)
        // const three=document.querySelector('.three')
        // three.innerHTML=personArr[c]
        // personArr.splice(c,1)
        // console.log(personArr)
    </script>
</body>
</html>